<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                template="./../templates/StakeholderPortalTemplate.xhtml">

    <link href="./../resources/css/default.css" rel="stylesheet" type="text/css" />
    <link href="./../resources/css/tableLayout.css" rel="stylesheet" type="text/css" />
    <h:head>
        <title>Advertising Management</title>
    </h:head>
    <ui:define name="left">

    </ui:define>

    <ui:define name="content">
        <f:view beforePhase="#{viewEventManagedBean.initView}">

            <p:panel header="Events">
                <p:messages id="statusMessages" redisplay="true" />
                <h:panelGrid columns="1" cellpadding="1" >


                    <p:commandButton id ="btnAdd" actionListener="#{viewEventManagedBean.redirectPage}" 
                                     value ="#{bundle['btnAdd.event']}" style="float:right;"/>      

                    <h:outputText id="resultList" value="Total Promotion Created: &nbsp; #{viewEventManagedBean.eventsList.size()}" 
                                  style="font-size: 10px; color: red; float: left;"/>

                    <p:dataTable id="adListTable" var="event" 
                                 rendered="true" value="#{viewEventManagedBean.eventsList}">

                        <p:column>  
                            <f:facet name="header">  
                                #{bundle['header.bannerThumbnail']}
                            </f:facet>  
                            <center>
                            <p:graphicImage value="#{event.eventUrl}" style="width:100px; height:100px; border: 3px #000;" />
                            </center>
                        </p:column> 


                        <p:column>  
                            <f:facet name="header">  
                                #{bundle['name']}
                            </f:facet>  
                            <h:outputText value="#{event.eventName}" /> 

                        </p:column> 

                        <p:column>  
                            <f:facet name="header">  
                                #{bundle['desc']}
                            </f:facet>  
                            <h:outputText value="#{event.eventDesc}" escape="false"/> 

                        </p:column> 

                        <p:column>  
                            <f:facet name="header">  
                                #{bundle['organiser']}
                            </f:facet>  
                            <h:outputText value="#{event.organiser.organisationName}" /> 

                        </p:column> 

                        <p:column>  
                            <f:facet name="header">  
                                #{bundle['dates']}
                            </f:facet>  
                            <center>
                                <h:outputLabel id="calEventStartDate" value="#{event.when.startDate}">
                                    <f:convertDateTime dateStyle="medium" timeZone="UTC+8"/>
                                </h:outputLabel>
                                <br/>

                                <h:outputLabel id="pEndDatelabel" value ="-" style="font-weight: bold;" />
                                <br/>
                                <h:outputLabel id="calEventEndDate" value="#{event.when.endDate}">
                                    <f:convertDateTime dateStyle="medium" timeZone="UTC+8"/>
                                </h:outputLabel>
                            </center>
                        </p:column> 
                        <p:column>  
                            <f:facet name="header">  
                                #{bundle['admission']}
                            </f:facet>  
                            <center>
                            <h:outputText value="Free" id ="ticketFree" rendered="${event.ticket.price == 0}" />
                            </center>
                            <h:outputText value="#{editEventManagedBean.ticket.price}" 
                                          id ="ticketPrice" rendered="${editEventeventManagedBean.ticket.price >0}" style="float: right;" >

                                <f:convertNumber currencySymbol="$" groupingUsed="#{true}" maxFractionDigits="2" type="currency" />
                            </h:outputText>

                        </p:column> 


                        <p:column>  
                            <f:facet name="header">  
                                #{bundle['header.option']}
                            </f:facet>  
                            <p:commandButton id="btnEdit" image="ui-icon ui-icon-pencil"
                                             actionListener="#{viewEventManagedBean.view_Edit_Event(event)}" 
                                             title="#{bundle['managemedia.remove.button']}" />
                            <p:commandButton image="ui-icon ui-icon-trash" title="Delete" actionListener="#{viewEventManagedBean.view_Del_Event(event)}"/>  


                        </p:column> 





                    </p:dataTable>    


                </h:panelGrid>



            </p:panel>


        </f:view>
    </ui:define>
</ui:composition>
